package com.manager.assignment.zq.service.Impl;


import com.manager.assignment.zq.mapper.SetSellerMapper;
import com.manager.assignment.zq.service.SetSellerService;


import com.manager.model.model.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 根据客户Id分配销售员的实现类
 */

@Service
public class SetSellerImpl implements SetSellerService {

    @Autowired
    private SetSellerMapper setSellerMapper;

    @Override
    public boolean SetSeller(Integer customerId, Integer sellerId) {
        Customer customer = new Customer();
        Integer customerid = new Integer(customerId);
        Integer sellerid = new Integer(sellerId);
        customer.setId(customerid);
        customer.setSellerId(sellerid);
        setSellerMapper.updateById(customer);
        return true;
    }

    @Override
    public boolean RemoveCustomer(Integer customerId) {
        Customer customerInfo = new Customer();
        Integer customerid = new Integer(customerId);
        customerInfo.setId(customerid);
//        customerInfo = setSellerMapper.selectById(customerId);
//        customerInfo.setSellerId(null);
        setSellerMapper.updateSellerIdById(customerInfo);
        return true;
    }
}
